using System;
using System.Collections.Generic;
using System.Text;
using Evolution.Engine.Interfaces;
using System.Collections;
using Microsoft.Xna.Framework;

namespace Evolution.Engine.SpatialTrees
{
    public class ObjectList : ISpatialTree
    {
        public BaseObject this[string name]
        {
            get
            {
                return objects[name];
            }
        }

        Dictionary<string, BaseObject> objects = new Dictionary<string, BaseObject>();
        public ScenenodeCollection Nodes()
        {
            return null;
        }

        #region ISpatialTree Members

        public BaseObject Find(string name)
        {
            return this[name];
        }

        public void Add(BaseObject baseobject)
        {
            objects.Add(baseobject.Name, baseobject);
        }

        public void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            foreach (BaseObject obj in objects.Values)
                obj.Update(gameTime);
        }

        public void Draw(GameTime gameTime)
        {
            foreach (BaseObject obj in objects.Values)
                obj.Draw(gameTime);
        }

        public void LoadContent()
        {
            foreach (BaseObject obj in objects.Values)
                obj.LoadContent();
        }

        #endregion

        #region ISpatialTree Members


        public void LoadFromFile(string asset)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion
    }
}
